package com.coder.model;

import java.sql.Time;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name="isa")
public class Isa {
	
	//产品编号：isa或者55？
	private String ProdNr;
	private String SerNr;
	private String SensorNr;
	
	//日期
	private Date CDate;
	
	//sql time类型，格式02：30：50
	private Time CTime;
	
	//模式
	private int Mode;
	private float Max;
	
	//类型有待确定，在数据库中以varbinary存储，格式为0xA0F0003D
	private byte[] Data;
	
	/**float类型的数据，并不在数据库中存储。数据个数为256*/
	private ArrayList<Float> floatDatas;

	/** 联合主键*/
	private IsaKey isakey;
	
	//完整时间，格式为：yyyy-MM-DD hh:mm:ss
	private String dateTime;
	
	/** long类型的时间，用于求平均值*/
	private long longTime;
	
	@Override
	public String toString() {
		return "Isa [ProdNr=" + ProdNr + ", SerNr=" + SerNr + ", SensorNr="
				+ SensorNr + ", CDate=" + CDate + ", CTime=" + CTime
				+ ", Mode=" + Mode + ", Max=" + Max + ", Data="
				+ Arrays.toString(Data) + ", floatDatas=" + floatDatas + "]";
	}

	@Column(name="ProdNr")
	public String getProdNr() {
		return ProdNr;
	}

	public void setProdNr(String prodNr) {
		ProdNr = prodNr;
	}

	@Column(name="SerNr")
	public String getSerNr() {
		return SerNr;
	}

	public void setSerNr(String serNr) {
		SerNr = serNr;
	}

	@Column(name="SensorNr")
	public String getSensorNr() {
		return SensorNr;
	}

	public void setSensorNr(String sensorNr) {
		SensorNr = sensorNr;
	}

	@Column(name="CDate",insertable=false,updatable=false)
	public Date getCDate() {
		return CDate;
	}

	public void setCDate(Date cDate) {
		CDate = cDate;
	}

	@Column(name="CTime",insertable=false,updatable=false)
	public Time getCTime() {
		return CTime;
	}

	public void setCTime(Time cTime) {
		CTime = cTime;
	}

	@Column(name="Mode")
	public int getMode() {
		return Mode;
	}

	public void setMode(int mode) {
		Mode = mode;
	}

	@Column(name="Max")
	public float getMax() {
		return Max;
	}

	public void setMax(float max) {
		Max = max;
	}

	@Column(name="Data")
	public byte[] getData() {
		return Data;
	}

	public void setData(byte[] data) {
		Data = data;
	}

	@Id
	public IsaKey getIsakey() {
		return isakey;
	}

	public void setIsakey(IsaKey isakey) {
		this.isakey = isakey;
	}

	@Transient
	public ArrayList<Float> getFloatDatas() {
		return floatDatas;
	}

	public void setFloatDatas(ArrayList<Float> floatDatas) {
		this.floatDatas = floatDatas;
	}

	@Transient
	public String getDateTime() {
		return dateTime;
	}

	public void setDateTime(String dateTime) {
		this.dateTime = dateTime;
	}

	@Transient
	public long getLongTime() {
		return longTime;
	}

	public void setLongTime(long longTime) {
		this.longTime = longTime;
	}
	
}
